package pl.com.qapps.datastore;

import java.util.Map;

import com.google.appengine.api.datastore.PreparedQuery;
import com.google.appengine.api.datastore.Query;
import com.google.appengine.api.datastore.Transaction;
import com.google.appengine.api.datastore.TransactionOptions;
import com.google.storage.onestore.v3.OnestoreEntity.EntityProto;
import com.google.storage.onestore.v3.OnestoreEntity.Reference;

/**
 * TODO why this class?
 * 
 * @author Jakub Dykowski
 * 
 */
@Deprecated
public interface DatastoreHandler {

	/**
	 * Handles the put operation. If transaction is other than null the entities
	 * belongs to the same entity group. The entity keys are considered
	 * complete.
	 * 
	 * @param txn
	 *            or null if without transaction
	 * @param entities
	 *            to put
	 */
	void makePut(Transaction txn, Iterable<EntityProto> entities);

	Map<Reference, EntityProto> makeGet(Transaction txn,
			Iterable<Reference> keys);

	void makeDelete(Transaction txn, Iterable<Reference> keys);

	/**
	 * Directly calls omits current transaction caching.
	 * 
	 * @param options
	 *            non null
	 * @return non null new Transaction
	 */
	Transaction newTransaction(TransactionOptions options);

	/**
	 * 
	 * @param txn
	 *            non null txn
	 * @param query
	 * @return new prepared query
	 */
	PreparedQuery newAncestorQuery(Transaction txn, Query query);

	/**
	 * 
	 * @param query
	 *            non null query
	 * @return new prepared query
	 */
	PreparedQuery newQuery(Query query);

}
